
//
//  ZJOSTeacherInfoHeaderView.m
//  ShangHaiHuDongApp
//
//  Created by ZJ on 2017/7/20.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "ZJOSTeacherInfoHeaderView.h"
#import "ZJOSTeacherView.h"
#import "ZJIntroduceView.h"
#import "LPRedViewAndLableView.h"
@interface ZJOSTeacherInfoHeaderView ()
{
    UIView *view;
    UIView *view2;
}
/** 讲师头像与名字 */
@property (nonatomic, strong) ZJOSTeacherView *teacherView;
/** 课程介绍 */
@property (nonatomic, strong) ZJIntroduceView *course;
/** 研究方向 */
@property (nonatomic, strong) ZJIntroduceView *research;
/** 课程表 */
@property (nonatomic, strong) LPRedViewAndLableView *courseView;
@end

@implementation ZJOSTeacherInfoHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        //最上面的分割线
        view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.width, 8 * [UIScreen zj_screenHScale])];
        view.backgroundColor = [UIColor themeGrayColor];
        [self addSubview:view];
        [self addSubview:self.teacherView];
        //第二个分割线
        view2 =  [[UIView alloc]initWithFrame:CGRectMake(0, self.teacherView.bottom, self.width, 4 * [UIScreen zj_screenHScale])];
        view2.backgroundColor = view.backgroundColor;
        [self addSubview:view2];
        
        [self addSubview:self.course];
        [self addSubview:self.research];
        [self addSubview:self.courseView];
        
        self.course.sd_layout
        .topSpaceToView(view2, 0)
        .leftSpaceToView(self, 0)
        .widthIs(self.width)
        .heightIs(10);
        
        self.research.sd_layout
        .topSpaceToView(self.course, 0)
        .leftSpaceToView(self, 0)
        .widthIs(self.width)
        .heightIs(10);
        
        self.courseView.sd_layout
        .topSpaceToView(self.research, 0)
        .leftSpaceToView(self, 0)
        .widthIs(self.width)
        .heightIs(40 * [UIScreen zj_screenHScale]);
        
        
    }
    return self;
}


- (void)set{
 
    
}




#pragma mark - Setter
- (void)setModel:(ZJSchoolTeacherModel *)model{
    _model = model;
    self.teacherView.model = model;
    self.course.contentText = [NSString string:model.ABOUT isNilStringReturnDeftString:@"暂无简介"];
    self.course.sd_layout
    .topSpaceToView(view2, 0)
    .leftSpaceToView(self, 0)
    .widthIs(self.width)
    .heightIs(self.course.height);
    [self.course updateLayout];
    
    self.research.contentText = [NSString string:model.RESEARCH isNilStringReturnDeftString:@"暂无介绍"];
   
    self.research.sd_layout
    .topSpaceToView(self.course, 0)
    .leftSpaceToView(self, 0)
    .widthIs(self.width)
    .heightIs(self.research.height);
    [self.research updateLayout];
    
    self.height = self.courseView.bottom;
    
}

#pragma mark - Getters
- (ZJOSTeacherView *)teacherView{
    if (_teacherView == nil){
        _teacherView = [[ZJOSTeacherView alloc]initWithFrame:CGRectMake(0, 24 * [UIScreen zj_screenHScale]  , 96 * [UIScreen zj_screenWScale], 165 * [UIScreen zj_screenHScale])];
        _teacherView.centerX = self.centerX;
    }
    return _teacherView;
}
- (ZJIntroduceView *)course{
    if (_course == nil){
        _course = [[ZJIntroduceView alloc] initWithFrame:CGRectMake(0, 0, self.width, 10) title:@"老师简介"];
        
    }
    return _course;
}

- (ZJIntroduceView *)research{
    if (_research == nil){
        _research = [[ZJIntroduceView alloc] initWithFrame:CGRectMake(0, 0, self.width, 10) title:@"研究方向"];
    }
    return _research;
}
- (LPRedViewAndLableView *)courseView{
    if (_courseView == nil){
        _courseView = [[LPRedViewAndLableView alloc]initWithFrame:CGRectMake(0, 0, self.width, 40 * [UIScreen zj_screenHScale])];
        _courseView.titleLabel.text = @"课程表";
    }
    return _courseView;
}

@end
